package com.czb.wisdomcashier.utils

/**
 * 描述：
 * 时间： 2020/7/14.
 * 创建： 北京研发中心 zzt
 */
class FccUtils private constructor() {



    fun initNdk() {
        System.loadLibrary("native-lib")
    }

    fun log(string: String?) {}
    fun systemTime(i: Int, str: String?) {}

    /**
     * @param i 0 断开 1连接 集线器状态
     * @param b
     */
    fun connection(i: Int, b: Boolean) {}
    fun call(o: Any?) {}
    external fun QryNZLOilInfo(mdcNo: Int, chlNo: Int, nzl: Int): Int
    external fun SetNZLOilInfo(mdcNo: Int, ChlNo: Int, nzl: Int, OilCode: Int, Price: Int, Density: Int): Int
    external fun SetMDCTime(
        mdcNo: Int,
        year: Int, month: Int, day: Int,
        hour: Int, min: Int, sec: Int
    ): Int

    external fun QryMDCTime(mdcNo: Int): Int
    external fun QryVTOT(mdcNo: Int, chlNo: Int, nzl: Int): Int

    /**
     * @param chlNo
     * @param ttcNo 交易流水号
     * @return
     */
    external fun QryTTC(mdcNo: Int, chlNo: Int, ttcNo: Int): Int
    external fun initAll(mdcNo: Int, ip: String?, port: Int): Int
    external fun MDCInit(mdcNo: Int, ip: String?, port: Int): Int
    external fun Uinitialize(mdcNo: Int): Int
    external fun getMaxTTC(mdcNo: Int, chlNo: Int, nzl: Int): Int
    external fun setAuthCfg(
        mdcNo: Int,
        hourstart: Int, minstart: Int, secstart: Int,
        hourend: Int, minend: Int, secend: Int
    ): Int

    /*public native int setAuthCfg(int mdcNo,
                                 int hourstart1, int minstart1, int secstart1,
                                 int hourend1, int minend1, int secend1,
                                 int hourstart2, int minstart2, int secstart2,
                                 int hourend2, int minend2, int secend2);

    public native int setAuthCfg(int mdcNo,
                                 int hourstart1, int minstart1, int secstart1,
                                 int hourend1, int minend1, int secend1,
                                 int hourstart2, int minstart2, int secstart2,
                                 int hourend2, int minend2, int secend2,
                                 int hourstart3, int minstart3, int secstart3,
                                 int hourend3, int minend3, int secend3);
*/
    external fun getAuthCfg(mdcNo: Int, chlNo: Int, nzl: Int): Int
    external fun gunAuth(mdcNo: Int, chlNo: Int, nzl: Int): Int
    external fun gunCancelAuth(mdcNo: Int, chlNo: Int, nzl: Int): Int
    external fun QryDevInfo(mdcNo: Int): Int
    external fun RegMDC(mdcNo: Int): Int
    external fun UnregMDC(mdcNo: Int): Int
    external fun startWork(mdcNo: Int): Int
    external fun StopWork(mdcNo: Int): Int
    external fun RegNotifyEventCallback(mdcNo: Int): Int
    external fun RegErrCallback(mdcNo: Int): Int
    external fun reStart(mdcNo: Int): Int

    companion object {
        @JvmStatic
        var instance: FccUtils = FccUtils()
            get() {
                if (field == null) {
                    field = FccUtils()
                }
                return field
            }
            private set
    }
}